FROM golang:alpine AS build
WORKDIR /app
ADD . /app
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN cd /app && go build -o wow-update-ip


FROM alpine
ENV WORKDIR /app
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*

WORKDIR $WORKDIR
ADD deploy/manifest     $WORKDIR/manifest

COPY --from=build /app/wow-update-ip $WORKDIR

# EXPOSE 8080
ENTRYPOINT ./wow-update-ip
